package com.demo;

import com.demo.controller.WebSocket;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * create by: anyu
 */
@SpringBootApplication
public class MySpringBootApplication {
    public static void main(String[] args) {
//        SpringApplication springApplication = new SpringApplication(MySpringBootApplication.class);
//        ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
//        //解决WebSocket不能注入的问题
//        WebSocket.setApplicationContext(configurableApplicationContext);
        SpringApplication.run(MySpringBootApplication.class,args);      //如果WebSocket要引入其他的类或者变量，则使用上面的，把注释去掉；这行的则进行注释；
    }



    @Bean
    RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
        return restTemplateBuilder.build();
    }


}
